# import matplotlib.pyplot as plt
import  os
from PIL import Image
import imagesize
import cv2

j = 0
i = 2
img_path = "E:\\桌面文件\\SANY-智能化研究院\项目相关\\云南建投搅拌站数据-户\\Material_level\\111.png"
# image = Image.open(img_path)
# # image = cv2.imread(img_path[i])
# width, height = imagesize.get(img_path) # 获取图片的尺寸
# print(width, height)
# if width == 2688:
#     img = image.crop((300,0,2700,1500))
# elif width == 640:
#     img = image.crop((100,0,640,480))
# elif width == 2560:
#     img = image.crop((300,0,2700,1500))
# elif width == 1080:
#     img = image.crop((200,0,1080,720))
image = cv2.imread(img_path)
if image is not None:
    
    # cv_image = cv2.resize(image,(720,640))
    cv2.imshow("init",image)
    # cv2.waitKey(2000)
    # image_gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
    # cv2.imshow("gray",gray)
    cv2.waitKey(2000)
# image_gray = image.convert('L')
# print(os.path.join(f"/home/h/搅拌站/盐城/0705_mix_more_gray/val/{j+1}/",f"{i}.jpg"))
# cv2.imwrite(os.path.join(f"/home/h/桌面/predict34_data/data_gray_cv2/train/{j+1}/",f"{i}.jpg"),image_gray)
# image_gray.save(os.path.join(f"/home/h/搅拌站/盐城/0705_mix_more_gray/val/{j+1}/",f"{i}.jpg"))
# plt.imshow(img)
# plt.show()